package com.code.base.info.service;

import java.util.List;
import java.util.Date;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.code.base.info.persistence.InfoResMapper;
import com.code.base.info.pojo.InfoRes;
import com.code.util.PrimaryKeyUtil;


@Service
public class InfoResService {


	@Resource
	private InfoResMapper infoResMapper;

	public Long getInsertId() {
		return PrimaryKeyUtil.generatePrimaryKey();
	}

	public InfoRes getDataById(Long id) {
		return infoResMapper.getDataById(id);
	}

	public List<InfoRes> getAllData() {
		return infoResMapper.getAllData();
	}

	public int getDataCountByCondition(InfoRes entity) {
		return infoResMapper.getDataCountByCondition(entity);
	}

	public List<InfoRes> getDataByCondition(InfoRes entity) {
		return infoResMapper.getDataByCondition(entity);
	}

	public int getDataCountByLikeCondition(InfoRes entity) {
		return infoResMapper.getDataCountByLikeCondition(entity);
	}

	public List<InfoRes> getDataByLikeCondition(InfoRes entity) {
		return infoResMapper.getDataByLikeCondition(entity);
	}

	public List<InfoRes> getDataByIds(Long[] ids) {
		return infoResMapper.getDataByIds(ids);
	}

	public void insertData(InfoRes entity) {
		insertData(entity, true);
	}

	public void insertData(InfoRes entity, boolean setIdValue) {
		if (setIdValue) {
			entity.setId(getInsertId());
		}
		infoResMapper.insertData(entity);
	}

	public void updateData(InfoRes entity) {
		infoResMapper.updateData(entity);
	}

	public void updateDataByParam(Map<String, Object> map) {
		if (map.size() == 0)
			return;

		infoResMapper.updateDataByParam(map);
	}

	public void deleteDataByObject(InfoRes entity) {
		infoResMapper.deleteDataByObject(entity);
	}

	public void deleteDataById(Long id) {
		infoResMapper.deleteDataById(id);
	}

	public void deleteDataByIds(Long[] ids) {
		infoResMapper.deleteDataByIds(ids);
	}

}
